package com.futonredemption.batterytest;

import android.content.Context;
import android.os.PowerManager;

public class WakeLockHolder {
	public PowerManager.WakeLock keepAwake = null;
	private static final String TAG = "WakeLockHolder";
	
	public WakeLockHolder(Context context) {
		PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
		keepAwake = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
	}
	
	public void acquire() {
		if(! keepAwake.isHeld()) {
			keepAwake.acquire();
		}
	}
	
	public void release() {
		keepAwake.release();
	}
}
